package com.nt.train.service.req;

import com.nt.train.annotation.RequestHandler;
import com.nt.train.dto.RequestDto;
import com.nt.train.dto.RequestTask;
import com.nt.train.enums.RequestEnum;
import com.nt.train.service.IRequestStrategy;
import com.nt.train.vo.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 目标指令
 * @author hlf
 * @version 1.0
 * @date 2022/1/13 17:35
 */
@Slf4j
@Service("goalRequestService")
@RequestHandler(RequestEnum.GOAL_REQUEST)
public class GoalReqServiceImpl implements IRequestStrategy {

    /**
     * 目标指令
     */
    @Autowired
    private GoalService goalService;

    /**
     * 解析任务
     * @param request
     * @return
     */
    @Override
    public ResultVo<List<RequestTask>> parseRequestTask(RequestDto request) {
        return this.resolve(request);
    }

    /**
     * 分解指令
     * @param request
     * @return
     */
    private ResultVo<List<RequestTask>> resolve(RequestDto request) {
        return goalService.resolve(request);
    }
}
